package com.winspread.mvvm.arouter.utils

import com.alibaba.android.arouter.launcher.ARouter
import androidx.fragment.app.Fragment


/**
 * 路由工具类
 */
object ARouterUtils {


    /**
     * 普通启动activity
     */
    fun startActivity(url: String) {
        ARouter.getInstance().build(url).navigation()
    }


    /**
     * 普通启动activity
     * 注意：@Autowir接收的时候调用ARouterUtils.inject(this)
     */
    fun startActivity(url: String, key: String, obj: Any?) {
        ARouter.getInstance().build(url).withObject(key, obj)
            .navigation()
    }


    /**
     * 获取Fragment
     */
    fun getFragment(url: String): Fragment {
        return ARouter.getInstance().build(url).navigation() as Fragment
    }

    /**
     * 获取对象调用
     */
    fun inject(thiz: Any?){
        ARouter.getInstance().inject(thiz)
    }



}